﻿@model BMCShowView.Portal.ViewModels.ChangeListViewModel
<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>变更页面</title>

    <link rel="stylesheet" href="~/Styles/global.css" />
    <link rel="stylesheet" href="~/Styles/Change.css" />
</head>
<body>
    <article id="top">
        <header>事件工单</header>
        <ul>
            <li>
                <div>故障单号</div>
                <div>故障来源</div>
                <div>客户</div>
                <div>故障大类</div>
                <div>故障小类</div>
                <div>优先级</div>
                <div>状态</div>
                <div>受理人</div>
                <div>故障描述</div>
            </li>
        </ul>
        <ul class="data">
            @foreach (var workOrder in Model.EventWorkOrders)
            {
                <li>
                    <div>@workOrder.Id</div>
                    <div>@workOrder.From</div>
                    <div>@workOrder.Customer</div>
                    <div>@workOrder.MajorClass</div>
                    <div>@workOrder.MinorClass</div>
                    <div>@workOrder.Priority</div>
                    <div>@workOrder.Status</div>
                    <div>@workOrder.Handler</div>
                    <div>@workOrder.Description</div>
                </li>
            }
        </ul>
    </article>

    <article id="bottom">
        <header>最新变更</header>
        <ul>
            <li>
                <div>变更卡编号</div>
                <div>变更事项</div>
                <div>变更日期</div>
                <div>实施时段</div>
                <div>负责人</div>
                <div>风险级别</div>
            </li>
        </ul>
        <ul class="data">
            @foreach (var change in Model.LatestChanges)
            {
                <li>
                    <div>@change.Id</div>
                    <div>@change.Content</div>
                    <div>@change.Date.ToShortDateString()</div>
                    <div>@change.Duration</div>
                    <div>@change.Handler</div>
                    <div>@change.Level</div>
                </li>
            }
        </ul>
    </article>
    <script src="~/Scripts/AutoScrollPage.js"></script>
    <script type="text/javascript">
        setAutoScrollPage(document.querySelector("#top ul.data"));
        setAutoScrollPage(document.querySelector("#bottom ul.data"));
        // 收到消息刷新
        new EventSource("Message").onmessage = function (e) {
            if (e.data === "Refresh") {
                location.reload();
            }
        };
        // 60分钟定时刷新
        window.setTimeout(function () {
            location.reload();
        }, 60 * 60 * 1000);
    </script>
</body>
</html>
